/*
 * Copyright (c) 2024. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
 * Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan.
 * Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna.
 * Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus.
 * Vestibulum commodo. Ut rhoncus gravida arcu.
 */

package com.neusoft.tyut.myspring.entity;

// 如果A的a方法以B类为形参，那么我称为 A依赖B
public class Computer {
    public static void main(String[] args) {
        //        控制反转<------------->控制正转
        Printer printer = new Printer();
        printer.age = 10;
        printer.print();
        printer = null;
    }

    //    final private Printer  printer  = new Printer()  ;
    //
    //    public Computer( Printer printer ){
    //        this.printer = printer;
    //    }
    //
    //
    //    public void setPrinter(Printer printer) {
    //        this.printer = printer;
    //    }
    //
    //    public void print(Printer printer){
    //        printer.print();
    //    }

    //    public static void main(String[] args) {
    //        Printer printer = new Printer();
    //        Computer computer1 = new Computer();
    //        computer1.print(printer);
    //        Computer computer2 = new Computer();
    //        computer2.print(printer);
    //    }
}
